﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucAddNewItem.ascx.cs"
    Inherits="Admin_ucControl_ucAddNewItem" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="cc1" %>
<div id="postedit" class="clearfix">
    <h2 class="ico_mug">
        SẢN PHẨM</h2>
    <table class="yui" width="100%">
        <tr>
            <td style="width: 50%" colspan="2">
                <b>Thông Tin sản Phẩm</b><br />
                <br />
                <table width="60%">
                    <tr>
                        <td style="width: 80px">
                            Ngôn ngữ
                        </td>
                        <td>
                            <asp:DropDownList ID="drLang" runat="server" Width="120px">
                                <asp:ListItem Value="1" Text="VietNam"></asp:ListItem>
                                <asp:ListItem Value="2" Text="English"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
                <br />
                <table width="100%">
                    <tr>
                        <td style="width: 50%">
                            <table class="yui" style="border: 0px; width: 100%">
                                <tr>
                                    <td style="width: 50%">
                                        Mã số Sản phẩm
                                    </td>
                                    <td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                                            ControlToValidate="txtNumItem"></asp:RequiredFieldValidator>
                                        <asp:TextBox ID="txtNumItem" runat="server" Style="width: 80%"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Tên Sản Phẩm
                                    </td>
                                    <td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"
                                            ControlToValidate="txtTenSP"></asp:RequiredFieldValidator>
                                        <asp:TextBox ID="txtTenSP" runat="server" Style="width: 80%"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Loại Sản Phẩm
                                    </td>
                                    <td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="*"
                                            ControlToValidate="drLoaiSP"></asp:RequiredFieldValidator>
                                        <asp:DropDownList ID="drLoaiSP" runat="server" Style="width: 80%">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Số lượng sản phẩm
                                    </td>
                                    <td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
                                            ControlToValidate="txtsoluong"></asp:RequiredFieldValidator>
                                        <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" FilterType="Numbers" TargetControlID="txtSoluong"
                                            runat="server">
                                        </asp:FilteredTextBoxExtender>
                                        <asp:TextBox ID="txtsoluong" runat="server" Style="width: 80%"></asp:TextBox>
                                    </td>
                                </tr>
                                <%--<tr>
                                    <td>
                                        Giá
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TextBox3" runat="server" Style="width: 20%"></asp:TextBox>VND<br />
                                        (Nếu không có giá, vui lòng điền số <span style="color: Red">0</span>)
                                    </td>
                                </tr>--%>
                            </table>
                        </td>
                        <td>
                            <table class="yui" style="border: 0px; width: 100%">
                                <tr>
                                    <td class="style1">
                                        Giá
                                    </td>
                                    <td class="style1">
                                        <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" FilterType="Numbers"
                                            TargetControlID="txtPrice">
                                        </asp:FilteredTextBoxExtender>
                                        <asp:TextBox ID="txtPrice" runat="server"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*"
                                            ControlToValidate="txtPrice"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Sản phẩm khuyến mãi
                                    </td>
                                    <td>
                                        <asp:RadioButton ID="rdYes" runat="server" Text="Có" GroupName="khuyenmai" Width="80px"
                                            onclick="CheckFee()" />
                                        <asp:RadioButton ID="rdNo" Text="Không" GroupName="khuyenmai" runat="server" Checked="true"
                                            onclick="CheckFee()" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label ID="lbmakhuyenmai" runat="server" Text="Khuyến mãi"></asp:Label>
                                    </td>
                                    <td>
                                        <%-- <asp:UpdatePanel ID="up" runat="server">
                                            <ContentTemplate>--%>
                                        <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" FilterType="Numbers"
                                            TargetControlID="txtmakhuyenmai">
                                        </asp:FilteredTextBoxExtender>
                                        <asp:TextBox ID="txtmakhuyenmai" runat="server" AutoPostBack="True" OnTextChanged="txtmakhuyenmai_TextChanged"></asp:TextBox>
                                        <%--  </ContentTemplate>--%>
                                        <%-- <Triggers>
                                                <asp:AsyncPostBackTrigger ControlID="txtmakhuyenmai" EventName="TextChanged" />
                                            </Triggers>--%>
                                        <%--</asp:UpdatePanel>--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label ID="lbGiaKhuyenmai" runat="server" Text=" Giá khuyến mãi"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtPricekhuyenmai" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="padding-top: 8px; padding-left: 10px">
                            <asp:Label ID="Label1" runat="server" Text="Mô tả sản phẩm"></asp:Label>
                            <br />
                            <cc1:Editor ID="edttsp" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right">
                            <asp:Button ID="btnLuu" runat="server" Text="Lưu" OnClick="btnLuu_Click" />
                        </td>
                        <td>
                            <asp:Button ID="btnCancel" runat="server" Text="Làm lại" OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    
    <b>
        <asp:Label ID="lbl1" runat="server" Text="Hình Sản Phẩm"></asp:Label></b><br />
    <asp:GridView ID="grdImgItems" runat="server" AutoGenerateColumns="False" 
        CssClass="yui" EmptyDataText="Không có hình ảnh nào" 
        OnRowDataBound="grdImgItems_RowDataBound" Width="500px">
        <Columns>
            <asp:ImageField DataImageUrlField="ImageURL" 
                DataImageUrlFormatString="~/Admin/Img/Items/{0}" HeaderText="Hình Ảnh">
                <ControlStyle Height="80px" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:ImageField>
            <asp:TemplateField HeaderText="Mặc Định">
                <ItemTemplate>
                    <asp:CheckBox ID="chkDefault" runat="server" Enabled="false" />
                    <asp:ImageButton ID="btnDefault" runat="server" 
                        ImageUrl="~/Admin/img/accept.jpg" OnClick="btnDefault_Click" />
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Xóa">
                <ItemTemplate>
                    <asp:ImageButton ID="btnDelImg" runat="server" CausesValidation="false" 
                        CommandArgument='<%# Eval("ID") %>' CommandName="delete" 
                        ImageUrl="~/Admin/img/Del.png" OnClick="btnDelImg_Click" />
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
            </asp:TemplateField>
        </Columns>
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
            HorizontalAlign="Center" />
        <EmptyDataTemplate>
            Not found Images
        </EmptyDataTemplate>
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" Height="30px" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    <br />
    <div>
        <h3>
            <asp:Label ID="lblImage" runat="server" Text=""></asp:Label></h3>
        <br />
        <asp:FileUpload ID="fileUpload" runat="server" />
        <br />
        <asp:Label ID="lblMessage" runat="server" Style="color: Red"></asp:Label>
    </div>
    <asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Tải Lên" />
    <%--<div class="left form_sidebar"></div>--%>
</div>

<script language="javascript" type="text/javascript">
    function CheckFee() {
        var rdYes = document.getElementById("<%=rdYes.ClientID %>");
        var rdNo = document.getElementById("<%=rdNo.ClientID %>");
        var txtmakhuyenmai = document.getElementById("<%=txtmakhuyenmai.ClientID %>");
        var txtPricekhuyenmai = document.getElementById("<%=txtPricekhuyenmai.ClientID %>");

        if (rdNo.checked == true) {
            txtmakhuyenmai.disabled = true;
            txtPricekhuyenmai.disabled = true;
        }
        else {
            txtmakhuyenmai.disabled = false;
            txtPricekhuyenmai.disabled = false;
        }
    }
</script>

